package com.major.tree.avltree;

import com.major.sort.insertsorting.InsertSort;

public class AvlTreeMain {
    public static void main(String[] args) {
        //int[] arr = {9999,3,2,45,3,45,573,67,8,34,679,34,834,6,56,7,56,5,45,246,5867,4756,4,4587,67,58,59786,5678,567,9,4687,964,5687,7859,4678,4679,54678,47856,5678,24,32,13,1,2,2,7,56,5679,79,0,3457,3,24,47};
//        int[] arr = new int[20000];
//        for (int i = 0; i < 20000; i++) {
//            arr[i] = (int) (Math.random() * 10000);
//        }

        int[] arr = {10,11,7,6,8,9};
        AvlTree avlTree = new AvlTree();
        //long millis = System.currentTimeMillis();
        for (int value : arr) {
            avlTree.add(new Node(value));
        }
        //System.out.println(System.currentTimeMillis() - millis);

        //avlTree.infixOrder();
        System.out.println("平衡之后的高度："+avlTree.getRoot().height());
        System.out.println("左子树高度："+ avlTree.getRoot().leftHeight());
        System.out.println("右子树高度："+ avlTree.getRoot().rightHeight());
        System.out.println(avlTree);
    }
}
